package com.taobao.txc.common;

import com.taobao.middleware.logger.Level;
import com.taobao.middleware.logger.Logger;
import com.taobao.middleware.logger.LoggerFactory;
import com.taobao.txc.common.a.a;
import com.taobao.txc.common.b.b;
import com.taobao.txc.common.config.o;
import com.taobao.txc.common.util.c.d;
import org.apache.commons.lang.StringUtils;

public class LoggerWrap
{
  public Logger[] a = new Logger[2];
  private String b = getClass().getName();
  
  private String e()
  {
    StackTraceElement[] arrayOfStackTraceElement = new Throwable().getStackTrace();
    for (int i = 0; i < arrayOfStackTraceElement.length; i++)
    {
      String str = arrayOfStackTraceElement[i].getClassName();
      if (!str.equals(this.b))
      {
        String[] arrayOfString = str.split("\\.");
        return String.format("%s:%s:%d", new Object[] { arrayOfString[(arrayOfString.length - 1)], arrayOfStackTraceElement[i].getMethodName(), Integer.valueOf(arrayOfStackTraceElement[i].getLineNumber()) });
      }
    }
    return "";
  }
  
  public void a(boolean paramBoolean, String paramString)
  {
    if (paramBoolean)
    {
      this.a[0] = LoggerFactory.getLogger("txc");
      this.a[0].activateAppenderWithSizeRolling("txc", "txc." + paramString + ".log", "utf-8", "512MB", 20);
      this.a[1] = LoggerFactory.getLogger("txc_error");
      this.a[1].activateAppenderWithSizeRolling("txc", "txc_error.log", "utf-8", "512MB", 20);
    }
    else
    {
      this.a[0] = LoggerFactory.getLogger("txc");
      this.a[0].activateConsoleAppender("System.out", "utf-8");
    }
    this.a[0].setAdditivity(false);
    this.a[1].setAdditivity(false);
    this.a[0].setLevel(Level.INFO);
    this.a[1].setLevel(Level.WARN);
  }
  
  public void a()
  {
    o.a().a(new c(this));
  }
  
  public void debug(String paramString)
  {
    this.a[0].debug(e(), paramString);
  }
  
  public void debug(String paramString, Object... paramVarArgs)
  {
    this.a[0].debug(e(), paramString, paramVarArgs);
  }
  
  public void info(String paramString)
  {
    this.a[0].info(e(), paramString);
  }
  
  public void info(String paramString, Object... paramVarArgs)
  {
    this.a[0].info(e(), paramString, paramVarArgs);
  }
  
  public void a(d paramd, String paramString1, String paramString2)
  {
    this.a[0].warn(e(), paramString2);
    if (this.a[1] != null)
    {
      if (paramd == null) {
        paramd = new d();
      }
      paramd.a = "WARN";
      paramd.b = e();
      paramd.e = paramString2;
      if (!StringUtils.isEmpty(paramString1)) {
        paramd.c = paramString1;
      }
      this.a[1].warn(paramd.a());
    }
  }
  
  public void a(d paramd, String paramString1, String paramString2, Object... paramVarArgs)
  {
    a(paramd, paramString1, String.format(paramString2, paramVarArgs));
  }
  
  public void warn(String paramString)
  {
    a((d)null, null, paramString);
  }
  
  public void warn(String paramString1, String paramString2)
  {
    a((d)null, paramString1, paramString2);
  }
  
  public void warn(String paramString, Object... paramVarArgs)
  {
    a((d)null, null, paramString, paramVarArgs);
  }
  
  public void a(d paramd, String paramString1, String paramString2, Throwable paramThrowable)
  {
    this.a[0].error(e(), paramString1, paramString2, paramThrowable);
    if ((this.a[1] != null) && (g.a.equals(i.a)))
    {
      if (paramd == null) {
        paramd = new d();
      }
      paramd.a = "ERROR";
      paramd.e = paramString2;
      paramd.b = e();
      paramd.d = paramThrowable;
      if (!StringUtils.isEmpty(paramString1)) {
        paramd.c = paramString1;
      }
      this.a[1].error("", paramd.a());
    }
  }
  
  public void a(b paramb, Throwable paramThrowable)
  {
    a((d)null, paramb.bd, paramb.be, paramThrowable);
  }
  
  public void error(String paramString1, String paramString2)
  {
    a((d)null, paramString1, paramString2, (Throwable)null);
  }
  
  public void a(String paramString1, String paramString2, Throwable paramThrowable)
  {
    a((d)null, paramString1, paramString2, paramThrowable);
  }
  
  public void a(String paramString1, String paramString2, Object... paramVarArgs)
  {
    b((d)null, paramString1, paramString2, new Object[] { paramVarArgs, null });
  }
  
  public void b(d paramd, String paramString1, String paramString2, Object... paramVarArgs)
  {
    a(paramd, paramString1, String.format(paramString2, paramVarArgs), (Throwable)null);
  }
  
  public void a(String paramString, b paramb, Throwable paramThrowable)
  {
    a((d)null, paramb.bd, String.format("%s:%s:%s", new Object[] { paramString, paramb.be, paramb.bf }), paramThrowable);
  }
  
  public void b(d paramd, String paramString1, String paramString2)
  {
    String str = String.format("<<ALARM>> %s", new Object[] { paramString2 });
    this.a[0].warn(e(), str);
    if (this.a[1] != null)
    {
      if (paramd == null) {
        paramd = new d();
      }
      paramd.a = "ALARM";
      paramd.e = paramString2;
      paramd.b = e();
      if (!StringUtils.isEmpty(paramString1)) {
        paramd.c = paramString1;
      }
      this.a[1].warn(paramd.a());
    }
  }
  
  public void a(String paramString)
  {
    b((d)null, null, paramString);
  }
  
  public void a(String paramString, Object... paramVarArgs)
  {
    a.a().a(paramString, paramVarArgs);
  }
  
  public boolean b()
  {
    return o.a().c();
  }
  
  public boolean c()
  {
    return this.a[0].isDebugEnabled();
  }
  
  public boolean d()
  {
    return this.a[0].isDebugEnabled();
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.common.LoggerWrap
 * JD-Core Version:    0.7.0.1
 */